package com.lianniu.mgr.buyerManage.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.lianniu.mgr.base.BaseResult;
import com.lianniu.mgr.buyerManage.dao.IBuyerConsigneeDao;
import com.lianniu.mgr.buyerManage.service.IBuyerConsigneeService;
import com.lianniu.mgr.buyerManage.vo.BuyerConsigneeConditionVo;
import com.lianniu.mgr.buyerManage.vo.BuyerConsigneeVo;
@Service()
public class BuyerConsigneeServiceImpl implements IBuyerConsigneeService{
  private static final Logger logger = LoggerFactory.getLogger(BuyerConsigneeServiceImpl.class);
  @Autowired
  IBuyerConsigneeDao buyerConsigneeDao;
  /**
   * @Title: getBuyerConsigneeList 
   * @Description: 所有的收货地址列表
   * @author: Administrator
   * @param condition
   * @return
   * @date: 2016年7月9日 下午8:55:56 
   * @return: List<BuyerConsigneeVo>
   */
  public BaseResult getBuyerConsigneeList(BuyerConsigneeConditionVo condition){
    logger.info("get buyer consignee list :"+JSON.toJSONString(condition));
    List<BuyerConsigneeVo> list= buyerConsigneeDao.getBuyerConsigneeList(condition);
    logger.info("buyer consignee lists is : "+JSON.toJSONString(list));
    return BaseResult.success(list);
  }
  /**
   * @Title: getBuyerConsinee 
   * @Description: 根据ID获取收货地址
   * @author: Administrator
   * @param id
   * @return
   * @date: 2016年7月9日 下午8:57:25 
   * @return: BuyerConsigneeVo
   */
  public BaseResult getBuyerConsinee(String id){
    logger.info("get buyer consignee through id :"+ id);
    BuyerConsigneeVo consignee = buyerConsigneeDao.getBuyerConsinee(id);
    logger.info("buyer consignee is :"+ JSON.toJSONString(consignee));
    return BaseResult.success(consignee);
  }
  /**
   * @Title: addBuyerConsignee 
   * @Description: 新增收货地址
   * @author: Dylan
   * @param consignee
   * @return
   * @date: 2016年7月9日 下午9:01:48 
   * @return: boolean
   */
  public BaseResult addBuyerConsignee(BuyerConsigneeVo consignee){
    logger.info("add buyer consignee : "+ JSON.toJSONString(consignee));
    buyerConsigneeDao.addBuyerConsignee(consignee);
    logger.info("add buyer consignee done");
    return BaseResult.success();
  }

}
